package com.sunfeng.fx;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @author sunfeng
 * @date 2021/03/04 18:13
 **/
@Slf4j(topic = "c.Test1")
public class Test1 {
    static  int r=0;
    public static void main(String[] args) {
        text();
    }

    public static void text(){
        log.debug("开始");
        Thread t1 = new Thread(() -> {
            log.debug("开始");
            try {
                TimeUnit.SECONDS.sleep(r);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("结束");
            r = 10;
        });
        t1.start();
        try {
            t1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.debug("结果为:{}", r);
        log.debug("结束");
    }
}
